3.83 \(\int \frac{(2+x) (d+e x+f x^2+g x^3+h x^4)}{4-5 x^2+x^4} \, dx\)

Optimal. Leaf size=74 \[ -\frac{1}{2} \log (1-x) (d+e+f+g+h)+\frac{1}{3} \log (2-x) (d+2 e+4 f+8 g+16 h)+\frac{1}{6} \log (x+1) (d-e+f-g+h)+x (g+2 h)+\frac{h x^2}{2} \]

[Out]

(g + 2*h)*x + (h*x^2)/2 - ((d + e + f + g + h)*Log[1 - x])/2 + ((d + 2*e + 4*f + 8*g + 16*h)*Log[2 - x])/3 + (
(d - e + f - g + h)*Log[1 + x])/6

________________________________________________________________________________________

Rubi [A]  time = 0.106973, antiderivative size = 74, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 2, integrand size = 36, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.056, Rules used = {1586, 2074} \[ -\frac{1}{2} \log (1-x) (d+e+f+g+h)+\frac{1}{3} \log (2-x) (d+2 e+4 f+8 g+16 h)+\frac{1}{6} \log (x+1) (d-e+f-g+h)+x (g+2 h)+\frac{h x^2}{2} \]

Antiderivative was successfully verified.

[In]

Int[((2 + x)*(d + e*x + f*x^2 + g*x^3 + h*x^4))/(4 - 5*x^2 + x^4),x]

[Out]

(g + 2*h)*x + (h*x^2)/2 - ((d + e + f + g + h)*Log[1 - x])/2 + ((d + 2*e + 4*f + 8*g + 16*h)*Log[2 - x])/3 + (
(d - e + f - g + h)*Log[1 + x])/6

Rule 1586

Int[(u_.)*(Px_)^(p_.)*(Qx_)^(q_.), x_Symbol] :> Int[u*PolynomialQuotient[Px, Qx, x]^p*Qx^(p + q), x] /; FreeQ[
q, x] && PolyQ[Px, x] && PolyQ[Qx, x] && EqQ[PolynomialRemainder[Px, Qx, x], 0] && IntegerQ[p] && LtQ[p*q, 0]

Rule 2074

Int[(P_)^(p_)*(Q_)^(q_.), x_Symbol] :> With[{PP = Factor[P]}, Int[ExpandIntegrand[PP^p*Q^q, x], x] /;  !SumQ[N
onfreeFactors[PP, x]]] /; FreeQ[q, x] && PolyQ[P, x] && PolyQ[Q, x] && IntegerQ[p] && NeQ[P, x]

Rubi steps

\begin{align*} \int \frac{(2+x) \left (d+e x+f x^2+g x^3+h x^4\right )}{4-5 x^2+x^4} \, dx &=\int \frac{d+e x+f x^2+g x^3+h x^4}{2-x-2 x^2+x^3} \, dx\\ &=\int \left (g \left (1+\frac{2 h}{g}\right )+\frac{d+2 e+4 f+8 g+16 h}{3 (-2+x)}+\frac{-d-e-f-g-h}{2 (-1+x)}+h x+\frac{d-e+f-g+h}{6 (1+x)}\right ) \, dx\\ &=(g+2 h) x+\frac{h x^2}{2}-\frac{1}{2} (d+e+f+g+h) \log (1-x)+\frac{1}{3} (d+2 e+4 f+8 g+16 h) \log (2-x)+\frac{1}{6} (d-e+f-g+h) \log (1+x)\\ \end{align*}

Mathematica [A]  time = 0.0360083, size = 71, normalized size = 0.96 \[ \frac{1}{6} \left (-3 \log (1-x) (d+e+f+g+h)+2 \log (2-x) (d+2 (e+2 f+4 g+8 h))+\log (x+1) (d-e+f-g+h)+6 x (g+2 h)+3 h x^2\right ) \]

Antiderivative was successfully verified.

[In]

Integrate[((2 + x)*(d + e*x + f*x^2 + g*x^3 + h*x^4))/(4 - 5*x^2 + x^4),x]

[Out]

(6*(g + 2*h)*x + 3*h*x^2 - 3*(d + e + f + g + h)*Log[1 - x] + 2*(d + 2*(e + 2*f + 4*g + 8*h))*Log[2 - x] + (d
- e + f - g + h)*Log[1 + x])/6

________________________________________________________________________________________

Maple [A]  time = 0.007, size = 120, normalized size = 1.6 \begin{align*}{\frac{h{x}^{2}}{2}}+gx+2\,hx+{\frac{\ln \left ( 1+x \right ) d}{6}}-{\frac{\ln \left ( 1+x \right ) e}{6}}+{\frac{\ln \left ( 1+x \right ) f}{6}}-{\frac{\ln \left ( 1+x \right ) g}{6}}+{\frac{\ln \left ( 1+x \right ) h}{6}}+{\frac{\ln \left ( x-2 \right ) d}{3}}+{\frac{2\,\ln \left ( x-2 \right ) e}{3}}+{\frac{4\,\ln \left ( x-2 \right ) f}{3}}+{\frac{8\,\ln \left ( x-2 \right ) g}{3}}+{\frac{16\,\ln \left ( x-2 \right ) h}{3}}-{\frac{\ln \left ( x-1 \right ) d}{2}}-{\frac{\ln \left ( x-1 \right ) e}{2}}-{\frac{\ln \left ( x-1 \right ) f}{2}}-{\frac{\ln \left ( x-1 \right ) g}{2}}-{\frac{\ln \left ( x-1 \right ) h}{2}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((2+x)*(h*x^4+g*x^3+f*x^2+e*x+d)/(x^4-5*x^2+4),x)

[Out]

1/2*h*x^2+g*x+2*h*x+1/6*ln(1+x)*d-1/6*ln(1+x)*e+1/6*ln(1+x)*f-1/6*ln(1+x)*g+1/6*ln(1+x)*h+1/3*ln(x-2)*d+2/3*ln
(x-2)*e+4/3*ln(x-2)*f+8/3*ln(x-2)*g+16/3*ln(x-2)*h-1/2*ln(x-1)*d-1/2*ln(x-1)*e-1/2*ln(x-1)*f-1/2*ln(x-1)*g-1/2
*ln(x-1)*h

________________________________________________________________________________________

Maxima [A]  time = 0.961344, size = 84, normalized size = 1.14 \begin{align*} \frac{1}{2} \, h x^{2} +{\left (g + 2 \, h\right )} x + \frac{1}{6} \,{\left (d - e + f - g + h\right )} \log \left (x + 1\right ) - \frac{1}{2} \,{\left (d + e + f + g + h\right )} \log \left (x - 1\right ) + \frac{1}{3} \,{\left (d + 2 \, e + 4 \, f + 8 \, g + 16 \, h\right )} \log \left (x - 2\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((2+x)*(h*x^4+g*x^3+f*x^2+e*x+d)/(x^4-5*x^2+4),x, algorithm="maxima")

[Out]

1/2*h*x^2 + (g + 2*h)*x + 1/6*(d - e + f - g + h)*log(x + 1) - 1/2*(d + e + f + g + h)*log(x - 1) + 1/3*(d + 2
*e + 4*f + 8*g + 16*h)*log(x - 2)

________________________________________________________________________________________

Fricas [A]  time = 1.87172, size = 196, normalized size = 2.65 \begin{align*} \frac{1}{2} \, h x^{2} +{\left (g + 2 \, h\right )} x + \frac{1}{6} \,{\left (d - e + f - g + h\right )} \log \left (x + 1\right ) - \frac{1}{2} \,{\left (d + e + f + g + h\right )} \log \left (x - 1\right ) + \frac{1}{3} \,{\left (d + 2 \, e + 4 \, f + 8 \, g + 16 \, h\right )} \log \left (x - 2\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((2+x)*(h*x^4+g*x^3+f*x^2+e*x+d)/(x^4-5*x^2+4),x, algorithm="fricas")

[Out]

1/2*h*x^2 + (g + 2*h)*x + 1/6*(d - e + f - g + h)*log(x + 1) - 1/2*(d + e + f + g + h)*log(x - 1) + 1/3*(d + 2
*e + 4*f + 8*g + 16*h)*log(x - 2)

________________________________________________________________________________________

Sympy [B]  time = 137.208, size = 2388, normalized size = 32.27 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((2+x)*(h*x**4+g*x**3+f*x**2+e*x+d)/(x**4-5*x**2+4),x)

[Out]

h*x**2/2 + x*(g + 2*h) + (d - e + f - g + h)*log(x + (26*d**3 + 66*d**2*e + 132*d**2*f + 174*d**2*g + 348*d**2
*h - 9*d**2*(d - e + f - g + h) + 78*d*e**2 + 276*d*e*f + 444*d*e*g + 852*d*e*h - 12*d*e*(d - e + f - g + h) +
 222*d*f**2 + 636*d*f*g + 1164*d*f*h + 6*d*f*(d - e + f - g + h) + 510*d*g**2 + 1788*d*g*h + 36*d*g*(d - e + f
 - g + h) + 1518*d*h**2 + 102*d*h*(d - e + f - g + h) - 7*d*(d - e + f - g + h)**2 + 46*e**3 + 204*e**2*f + 39
0*e**2*g + 708*e**2*h + 3*e**2*(d - e + f - g + h) + 282*e*f**2 + 984*e*f*g + 1716*e*f*h + 36*e*f*(d - e + f -
 g + h) + 930*e*g**2 + 3144*e*g*h + 102*e*g*(d - e + f - g + h) + 2586*e*h**2 + 228*e*h*(d - e + f - g + h) -
8*e*(d - e + f - g + h)**2 + 116*f**3 + 534*f**2*g + 852*f**2*h + 51*f**2*(d - e + f - g + h) + 924*f*g**2 + 2
796*f*g*h + 228*f*g*(d - e + f - g + h) + 1932*f*h**2 + 486*f*h*(d - e + f - g + h) - 13*f*(d - e + f - g + h)
**2 + 586*g**3 + 2580*g**2*h + 243*g**2*(d - e + f - g + h) + 3414*g*h**2 + 996*g*h*(d - e + f - g + h) - 20*g
*(d - e + f - g + h)**2 + 1196*h**3 + 1011*h**2*(d - e + f - g + h) - 37*h*(d - e + f - g + h)**2)/(10*d**3 +
69*d**2*e + 102*d**2*f + 213*d**2*g + 390*d**2*h + 102*d*e**2 + 318*d*e*f + 564*d*e*g + 1038*d*e*h + 246*d*f**
2 + 894*d*f*g + 1644*d*f*h + 750*d*g**2 + 2766*d*g*h + 2550*d*h**2 + 35*e**3 + 174*e**2*f + 249*e**2*g + 462*e
**2*h + 285*e*f**2 + 852*e*f*g + 1578*e*f*h + 537*e*g**2 + 2004*e*g*h + 1869*e*h**2 + 154*f**3 + 717*f**2*g +
1326*f**2*h + 966*f*g**2 + 3594*f*g*h + 3342*f*h**2 + 323*g**3 + 1830*g**2*h + 3453*g*h**2 + 2170*h**3))/6 - (
d + e + f + g + h)*log(x + (26*d**3 + 66*d**2*e + 132*d**2*f + 174*d**2*g + 348*d**2*h + 27*d**2*(d + e + f +
g + h) + 78*d*e**2 + 276*d*e*f + 444*d*e*g + 852*d*e*h + 36*d*e*(d + e + f + g + h) + 222*d*f**2 + 636*d*f*g +
 1164*d*f*h - 18*d*f*(d + e + f + g + h) + 510*d*g**2 + 1788*d*g*h - 108*d*g*(d + e + f + g + h) + 1518*d*h**2
 - 306*d*h*(d + e + f + g + h) - 63*d*(d + e + f + g + h)**2 + 46*e**3 + 204*e**2*f + 390*e**2*g + 708*e**2*h
- 9*e**2*(d + e + f + g + h) + 282*e*f**2 + 984*e*f*g + 1716*e*f*h - 108*e*f*(d + e + f + g + h) + 930*e*g**2
+ 3144*e*g*h - 306*e*g*(d + e + f + g + h) + 2586*e*h**2 - 684*e*h*(d + e + f + g + h) - 72*e*(d + e + f + g +
 h)**2 + 116*f**3 + 534*f**2*g + 852*f**2*h - 153*f**2*(d + e + f + g + h) + 924*f*g**2 + 2796*f*g*h - 684*f*g
*(d + e + f + g + h) + 1932*f*h**2 - 1458*f*h*(d + e + f + g + h) - 117*f*(d + e + f + g + h)**2 + 586*g**3 +
2580*g**2*h - 729*g**2*(d + e + f + g + h) + 3414*g*h**2 - 2988*g*h*(d + e + f + g + h) - 180*g*(d + e + f + g
 + h)**2 + 1196*h**3 - 3033*h**2*(d + e + f + g + h) - 333*h*(d + e + f + g + h)**2)/(10*d**3 + 69*d**2*e + 10
2*d**2*f + 213*d**2*g + 390*d**2*h + 102*d*e**2 + 318*d*e*f + 564*d*e*g + 1038*d*e*h + 246*d*f**2 + 894*d*f*g
+ 1644*d*f*h + 750*d*g**2 + 2766*d*g*h + 2550*d*h**2 + 35*e**3 + 174*e**2*f + 249*e**2*g + 462*e**2*h + 285*e*
f**2 + 852*e*f*g + 1578*e*f*h + 537*e*g**2 + 2004*e*g*h + 1869*e*h**2 + 154*f**3 + 717*f**2*g + 1326*f**2*h +
966*f*g**2 + 3594*f*g*h + 3342*f*h**2 + 323*g**3 + 1830*g**2*h + 3453*g*h**2 + 2170*h**3))/2 + (d + 2*e + 4*f
+ 8*g + 16*h)*log(x + (26*d**3 + 66*d**2*e + 132*d**2*f + 174*d**2*g + 348*d**2*h - 18*d**2*(d + 2*e + 4*f + 8
*g + 16*h) + 78*d*e**2 + 276*d*e*f + 444*d*e*g + 852*d*e*h - 24*d*e*(d + 2*e + 4*f + 8*g + 16*h) + 222*d*f**2
+ 636*d*f*g + 1164*d*f*h + 12*d*f*(d + 2*e + 4*f + 8*g + 16*h) + 510*d*g**2 + 1788*d*g*h + 72*d*g*(d + 2*e + 4
*f + 8*g + 16*h) + 1518*d*h**2 + 204*d*h*(d + 2*e + 4*f + 8*g + 16*h) - 28*d*(d + 2*e + 4*f + 8*g + 16*h)**2 +
 46*e**3 + 204*e**2*f + 390*e**2*g + 708*e**2*h + 6*e**2*(d + 2*e + 4*f + 8*g + 16*h) + 282*e*f**2 + 984*e*f*g
 + 1716*e*f*h + 72*e*f*(d + 2*e + 4*f + 8*g + 16*h) + 930*e*g**2 + 3144*e*g*h + 204*e*g*(d + 2*e + 4*f + 8*g +
 16*h) + 2586*e*h**2 + 456*e*h*(d + 2*e + 4*f + 8*g + 16*h) - 32*e*(d + 2*e + 4*f + 8*g + 16*h)**2 + 116*f**3
+ 534*f**2*g + 852*f**2*h + 102*f**2*(d + 2*e + 4*f + 8*g + 16*h) + 924*f*g**2 + 2796*f*g*h + 456*f*g*(d + 2*e
 + 4*f + 8*g + 16*h) + 1932*f*h**2 + 972*f*h*(d + 2*e + 4*f + 8*g + 16*h) - 52*f*(d + 2*e + 4*f + 8*g + 16*h)*
*2 + 586*g**3 + 2580*g**2*h + 486*g**2*(d + 2*e + 4*f + 8*g + 16*h) + 3414*g*h**2 + 1992*g*h*(d + 2*e + 4*f +
8*g + 16*h) - 80*g*(d + 2*e + 4*f + 8*g + 16*h)**2 + 1196*h**3 + 2022*h**2*(d + 2*e + 4*f + 8*g + 16*h) - 148*
h*(d + 2*e + 4*f + 8*g + 16*h)**2)/(10*d**3 + 69*d**2*e + 102*d**2*f + 213*d**2*g + 390*d**2*h + 102*d*e**2 +
318*d*e*f + 564*d*e*g + 1038*d*e*h + 246*d*f**2 + 894*d*f*g + 1644*d*f*h + 750*d*g**2 + 2766*d*g*h + 2550*d*h*
*2 + 35*e**3 + 174*e**2*f + 249*e**2*g + 462*e**2*h + 285*e*f**2 + 852*e*f*g + 1578*e*f*h + 537*e*g**2 + 2004*
e*g*h + 1869*e*h**2 + 154*f**3 + 717*f**2*g + 1326*f**2*h + 966*f*g**2 + 3594*f*g*h + 3342*f*h**2 + 323*g**3 +
 1830*g**2*h + 3453*g*h**2 + 2170*h**3))/3

________________________________________________________________________________________

Giac [A]  time = 1.07699, size = 92, normalized size = 1.24 \begin{align*} \frac{1}{2} \, h x^{2} + g x + 2 \, h x + \frac{1}{6} \,{\left (d + f - g + h - e\right )} \log \left ({\left | x + 1 \right |}\right ) - \frac{1}{2} \,{\left (d + f + g + h + e\right )} \log \left ({\left | x - 1 \right |}\right ) + \frac{1}{3} \,{\left (d + 4 \, f + 8 \, g + 16 \, h + 2 \, e\right )} \log \left ({\left | x - 2 \right |}\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((2+x)*(h*x^4+g*x^3+f*x^2+e*x+d)/(x^4-5*x^2+4),x, algorithm="giac")

[Out]

1/2*h*x^2 + g*x + 2*h*x + 1/6*(d + f - g + h - e)*log(abs(x + 1)) - 1/2*(d + f + g + h + e)*log(abs(x - 1)) +
1/3*(d + 4*f + 8*g + 16*h + 2*e)*log(abs(x - 2))